<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>检查两个⽇期是否相差⼀个⼩时</title>
</head>
<body>
    <script>
    var num =new Date('2022-12-10 12:12:10')
    var arr =new Date('2022-12-10 11:12:10')
        var obj=(num-arr)/1000
        var array=(parseInt(obj/60/60%24))
        if(array==1){
            alert('时')
        }
        else{
            alert('不是')
        }
        console.log(array+'小时')
    </script>
</body>
</html>